﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using ZHDJ.AppInterface.Common;
using ZHDJ.AppInterface.Models;
using ZHDJ.Core;

namespace ZHDJ.AppInterface.Controllers
{
    public class EduController : ApiController
    {
        #region 获取学习课件
        [HttpPost]
        public ReturnResult GetPartyEduCoursewareList(dynamic obj)
        {
            int pageIndex = Convert.ToInt32(obj.pageIndex);
            int pageSize = Convert.ToInt32(obj.pageSize);
            string Category = Convert.ToString(obj.Category);
            DataTable dt = InterfaceHelper.GetPartyEduCourseware(pageIndex, pageSize, Category).Tables[0];
            IList<PartyEduCourseware> list = DataTableToListModel<PartyEduCourseware>.ConvertToModel(dt);
            return new ReturnResult()
            {
                code = "200",
                result = list,
                msg = ""
            };
        }
        #endregion

        #region 获取学习课件实体
        /// <summary>
        /// 获取文章实体
        /// </summary>
        /// <param name="obj">参数</param>
        /// <returns></returns>
        [HttpPost]
        public ReturnResult GetArticleModel(dynamic obj)
        {
            string ID = Convert.ToString(obj.ID);
            Models.PartyEduCourseware model = InterfaceHelper.GetPartyEduCoursewareModel(ID);

            return new ReturnResult()
            {
                code = "200",
                result = model,
                msg = "success"
            };
        }
        #endregion

    }
}
